package com.example.vue_shop.components.login.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.vue_shop.components.login.service.LoginService;
import com.example.vue_shop.components.user.entity.User;
import com.example.vue_shop.components.user.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author lipengwei
 */
@Service
public class LoginServiceImpl implements LoginService {

    @Resource(name = "userMapper")
    private UserMapper userMapper;

    @Override
    public User login(User user) {
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("username", user.getUsername());
        return userMapper.selectOne(queryWrapper);
    }
}
